<?php
	/**
	 * 反馈
	 */
    class Feedbacks extends APIBase {
		
		public $tag = "Feedbacks";
    	public $isLogin = true;
		
		public function before() {
			$this->initCacheRedis();
			$this->initMysql();
			return true;
		}
		public function logic() {
			//$ann = $this->cache_redis->hMGet("ha:*", array("id","title","content","image_url"));
			if (!isset($this->param['content'])) {
				$this->makeError(300, 'content is needed');
				//return;
			}
			$userid =  $this->uid;
			$content = $this->param['content'];
			$now = time();
			$feedback = array(
				'uid' => $userid,
				'type' => 0,
				'status' => 0,
				'content' => $content,
				'reply' => '',
				'user_id' => 0,
				'create_time' => $now,
				'update_time' => $now
			);
			//var_dump($feedback);
			$ret = $this->mysql->insert("feedback", $feedback);
			if($ret){
				$this->returnData(NULL);
			}else{
				$this->returnError(301,"数据插入失败");
			}
			
		}
		
        public function after() {
			//$this->deinitCacheRedis();
			$this->deinitMysql();
		}
    }
?>
